
<div class="cvs form">
    <h3>Modifier votre cv</h3>
    <hr />
<?php
    echo $this->Form->create('Cv',array('type'=>'file'));

?>
  <table>
	<?php
            echo '<tr>';
                echo '<td>';
                    echo '<label>Titre</label>';
                echo '</td>';
                echo '<td>';
                    echo $this->Form->input('title', array('label'=> false));
                echo '</td>';
            echo '</tr>';
            echo '<tr>';
                echo '<td>';
                    echo '<label>Centre d\'intéret</label>';
                echo '</td>';
                echo '<td>';
                    echo $this->Form->input('interests', array('label'=> false));
                echo '</td>';
            echo '</tr>';
            echo '<tr>';
                echo '<td>';
                    echo '<label>Photo</label>';
                echo '</td>';
                echo '<td>';
                    if(!empty ($photo)) :
                    echo $html->image("/files/".$photo, array('class' => 'photo', 'id'=>'photo'));
                    echo $ajax->link(     
                                        'Supprimer l\'image',
                                        array( 'action' => 'delete_image', $id ),
                                        array( 'update' => 'cv', 'id' => 'photoDelete'),
                                        'Souhaitez-vous supprimer l\'image?'
                                    );
                    endif;
                    echo $form->input('picture', array('type' => 'file', 'label'=> false));
                echo '</td>';
            echo '</tr>';
            echo '<tr>';
                echo '<td>';
                    echo '<label>Import de cv</label>';
                echo '</td>';
                echo '<td>';
                    if(!empty ($cv)) :
                    echo $this->Html->link(__('Modification', true),"/files/".$cv , array_merge(array('class' => 'dwn_btn cv', 'id' => 'cv'), array('title' => 'Telecharger')));
                    echo $ajax->link(
                                        'Supprimer le CV',
                                        array( 'action' => 'delete_cv', $id ),
                                        array( 'update' => 'cv', 'id' => 'cvDelete'),
                                        'Souhaitez-vous supprimer le Cv?'
                                    );
                    endif;
                    echo $form->input('file', array('type' => 'file', 'label'=> false));
                echo '</td>';
            echo '</tr>';
            echo '<tr>';
                echo '<td>';
                    echo '<label>Début d\'affichage</label>';
                echo '</td>';
                echo '<td>';
                    echo $this->Form->input('started_at',array('label'=> false,'dateFormat' => 'DMY', 'monthNames' => false, 'minYear' => date('Y') , 'maxYear' => date('Y') + 5));
                echo '</td>';
            echo '</tr>';
            echo '<tr>';
                echo '<td>';
                    echo '<label>Fin d\'affichage</label>';
                echo '</td>';
                echo '<td>';
		echo $this->Form->input('ended_at',array('label'=> false,'dateFormat' => 'DMY', 'monthNames' => false, 'minYear' => date('Y') , 'maxYear' => date('Y') + 5));
                echo '</td>';
            echo '</tr>';
            ?>

           <tr>
                <td><h4 class="h4SM">Vos Langues connues</h4></td>
            </tr>
            <tr>
                <td colspan="2"><hr /></td>
            </tr>

            <?php
            echo '<tr>';
                echo '<td>';
                    echo '<label>Langue 1</label>';
                echo '</td>';
                echo '<td>';
                if(isset ($maLang[0])):
                    echo $form->text('Language.label', array('label'=> false, 'class' => 'langue', 'value' => $maLang[0]['label']));
                else :
                    echo $form->text('Language.label', array('label'=> false, 'class' => 'langue'));
                endif;
                $optionsLevel['Lu, écrit, parlé'] = 'Lu, écrit, parlé';
                $optionsLevel['Courant'] = 'Courant';
                $optionsLevel['Bilingue'] = 'Bilingue';
                if(isset ($maLang[0])):
                    echo $this->Form->input('Language.level',array('options' => $optionsLevel, 'type' => 'select', 'selected' => $maLang[0]['level'], 'label' => false) );
                else :
                    echo $this->Form->input('Language.level',array('options' => $optionsLevel, 'type' => 'select', 'label' => false) );
                endif;
                echo '</td>';
            echo '</tr>';
            echo '<tr>';
                echo '<td>';
                    echo '<label>Langue 2</label>';
                echo '</td>';
                echo '<td>';
                if(isset ($maLang[1])):
                    echo $form->text('Language2.label', array('label'=> false, 'class' => 'langue', 'value' => $maLang[1]['label']));
                    echo $this->Form->input('Language2.level',array('options' => $optionsLevel, 'type' => 'select', 'label' => false, 'selected' => $maLang[1]['level']) );
                else :
                    echo $form->text('Language2.label', array('label'=> false, 'class' => 'langue'));
                    echo $this->Form->input('Language2.level',array('options' => $optionsLevel, 'type' => 'select', 'label' => false) );
                endif;
                echo '</td>';
            echo '</tr>';
            echo '<tr>';
                echo '<td>';
                    echo '<label>Langue 3</label>';
                echo '</td>';
                echo '<td>';
                
                if(isset ($maLang[2])):
                    echo $form->text('Language3.label', array('label'=> false, 'class' => 'langue', 'value' => $maLang[2]['label']));
                    echo $this->Form->input('Language3.level',array('options' => $optionsLevel, 'type' => 'select', 'label' => false, 'selected' => $maLang[2]['level']) );
                else :
                    echo $form->text('Language3.label', array('label'=> false, 'class' => 'langue'));
                    echo $this->Form->input('Language3.level',array('options' => $optionsLevel, 'type' => 'select', 'label' => false) );
                endif;
                echo '</td>';
            echo '</tr>';
            ?>
           <tr>
               <td colspan="2"><h4 class="h4SM">Vos Expériences professionnelles</h4></td>
            </tr>
            <tr>
                <td colspan="2"><hr /></td>
            </tr>
            <?php
            echo '<tr>';
                echo '<td style="width:180px; vertical-align:top">';
                    echo '<label>Expérience Professionnelle 1 </label>';
                echo '</td>';
                echo '<td>';
            ?>
                <table>
                    <tr>
                        <td><label>Entreprise</label></td>
                        <?php if(isset($professionalRecords[0])):?>
                            <td><?php echo $form->textarea('ProfessionalRecord', array('label'=> false, 'value' => $professionalRecords[0]['job'])); ?></td>
                        <?php else:?>
                            <td><?php echo $form->textarea('ProfessionalRecord', array('label'=> false, 'value' => '')); ?></td>
                        <?php endif;?>
                    </tr>
                    <tr>
                        <td><label>Job</label></td>
                        <?php if(isset($professionalRecords[0])):?>
                            <td><?php echo $form->textarea('ProfessionalRecord.company', array('label'=> false, 'value' => $professionalRecords[0]['company'])); ?></td>
                        <?php else:?>
                            <td><?php echo $form->textarea('ProfessionalRecord.company', array('label'=> false)); ?></td>
                        <?php endif;?>
                    </tr>
                    <tr>
                        <td><label style="margin-right:10px">Date d'embauche</label></td>
                        <td >
                                <?php
                                    if(isset($professionalRecords[0])):
                                        echo $this->Form->input('ProfessionalRecord.started_at',array('label'=> 'Début', 'selected' => $professionalRecords[0]['started_at'], 'dateFormat' => 'DMY', 'monthNames' => false, 'minYear' => date('Y') , 'maxYear' => date('Y') - 100));
                                        echo $this->Form->input('ProfessionalRecord.ended_at',array('label'=> 'Fin', 'selected' => $professionalRecords[0]['ended_at'], 'dateFormat' => 'DMY', 'monthNames' => false, 'minYear' => date('Y') , 'maxYear' => date('Y') - 100));
                                    else:
                                        echo $this->Form->input('ProfessionalRecord.started_at',array('label'=> 'Début','dateFormat' => 'DMY', 'monthNames' => false, 'minYear' => date('Y') , 'maxYear' => date('Y') - 100));
                                        echo $this->Form->input('ProfessionalRecord.ended_at',array('label'=> 'Fin','dateFormat' => 'DMY', 'monthNames' => false, 'minYear' => date('Y') , 'maxYear' => date('Y') - 100));
                                    endif;
                                ?>
                            
                        </td>
                    </tr>
                    <tr>
                        <td ><label>Type de contrat</label></td>
                        <td><?php
                                $options['Stage'] = 'Stage';
                                $options['Bénévolat'] = 'Bénévolat';
                                $options['Employé'] = 'Employé';
                                if(isset($professionalRecords[0])):
                                    echo $this->Form->input('ProfessionalRecord.kind',array('options' => $options, 'selected' => $professionalRecords[0]['kind'], 'type' => 'select', 'label' => false) );
                                else :
                                    echo $this->Form->input('ProfessionalRecord.kind',array('options' => $options, 'type' => 'select', 'label' => false) );
                                endif;
                            ?>
                        </td>
                    </tr>
                </table>
                </td>
            </tr>         <?php
            echo '<tr>';
                echo '<td style="width:180px; vertical-align:top">';
                    echo '<label>Expérience Professionnelle 2 </label>';
                echo '</td>';
                echo '<td>';
            ?>
                <table>
                    <tr>
                        <td><label>Entreprise</label></td>
                        <?php if(isset($professionalRecords[1])):?>
                            <td><?php echo $form->textarea('ProfessionalRecord.ProfessionalRecord2', array('label'=> false, 'value' => $professionalRecords[1]['job'])); ?></td>
                        <?php else:?>
                            <td><?php echo $form->textarea('ProfessionalRecord.ProfessionalRecord2', array('label'=> false, 'value' => '')); ?></td>
                        <?php endif;?>
                    </tr>
                    <tr>
                        <td><label>Job</label></td>
                        <?php if(isset($professionalRecords[1])):?>
                            <td><?php echo $form->textarea('ProfessionalRecord2.company', array('label'=> false, 'value' => $professionalRecords[1]['company'])); ?></td>
                        <?php else:?>
                            <td><?php echo $form->textarea('ProfessionalRecord2.company', array('label'=> false)); ?></td>
                        <?php endif;?>
                    </tr>
                    <tr>
                        <td><label style="margin-right:10px">Date d'embauche</label></td>
                        <td >
                            <?php
                                if(isset($professionalRecords[1])):
                                    echo $this->Form->input('ProfessionalRecord.2.started_at',array('label'=> 'Début', 'selected' => $professionalRecords[1]['started_at'], 'dateFormat' => 'DMY', 'monthNames' => false, 'minYear' => date('Y') , 'maxYear' => date('Y') - 100));
                                    echo $this->Form->input('ProfessionalRecord.2.ended_at',array('label'=> 'Fin', 'selected' => $professionalRecords[1]['ended_at'], 'dateFormat' => 'DMY', 'monthNames' => false, 'minYear' => date('Y') , 'maxYear' => date('Y') - 100));
                                else:
                                    echo $this->Form->input('ProfessionalRecord.2.started_at',array('label'=> 'Début','dateFormat' => 'DMY', 'monthNames' => false, 'minYear' => date('Y') , 'maxYear' => date('Y') - 100));
                                    echo $this->Form->input('ProfessionalRecord.2.ended_at',array('label'=> 'Fin','dateFormat' => 'DMY', 'monthNames' => false, 'minYear' => date('Y') , 'maxYear' => date('Y') - 100));
                                endif;
                            ?>
                        </td>
                    </tr>
                    <tr>
                        <td ><label>Type de contrat</label></td>
                        <td><?php
                                $options['Stage'] = 'Stage';
                                $options['Bénévolat'] = 'Bénévolat';
                                $options['Employé'] = 'Employé';
                                if(isset($professionalRecords[1])):
                                    echo $this->Form->input('ProfessionalRecord2.kind',array('options' => $options, 'selected' => $professionalRecords[1]['kind'], 'type' => 'select', 'label' => false) );
                                else :
                                    echo $this->Form->input('ProfessionalRecord2.kind',array('options' => $options, 'type' => 'select', 'label' => false) );
                                endif;
                            ?>
                        </td>
                    </tr>
                </table>
                </td>
            </tr>         <?php
            echo '<tr>';
                echo '<td style="width:180px; vertical-align:top">';
                    echo '<label>Expérience Professionnelle 3 </label>';
                echo '</td>';
                echo '<td>';
            ?>
                <table>
                    <tr>
                        <td><label>Entreprise</label></td>
                        <?php if(isset($professionalRecords[2])):?>
                            <td><?php echo $form->textarea('ProfessionalRecord.ProfessionalRecord3', array('label'=> false, 'value' => $professionalRecords[2]['job'])); ?></td>
                        <?php else:?>
                            <td><?php echo $form->textarea('ProfessionalRecord.ProfessionalRecord3', array('label'=> false, 'value' => '')); ?></td>
                        <?php endif;?>
                    </tr>
                    <tr>
                        <td><label>Job</label></td>
                        <?php if(isset($professionalRecords[2])):?>
                            <td><?php echo $form->textarea('ProfessionalRecord3.company', array('label'=> false, 'value' => $professionalRecords[2]['company'])); ?></td>
                        <?php else:?>
                            <td><?php echo $form->textarea('ProfessionalRecord3.company', array('label'=> false)); ?></td>
                        <?php endif;?>
                    </tr>
                    <tr>
                        <td><label style="margin-right:10px">Date d'embauche</label></td>
                        <td >
                            <?php
                                if(isset($professionalRecords[2])):
                                    echo $this->Form->input('ProfessionalRecord.3.started_at',array('label'=> 'Début', 'selected' => $professionalRecords[2]['started_at'], 'dateFormat' => 'DMY', 'monthNames' => false, 'minYear' => date('Y') , 'maxYear' => date('Y') - 100));
                                    echo $this->Form->input('ProfessionalRecord.3.ended_at',array('label'=> 'Fin', 'selected' => $professionalRecords[2]['ended_at'], 'dateFormat' => 'DMY', 'monthNames' => false, 'minYear' => date('Y') , 'maxYear' => date('Y') - 100));
                                else:
                                    echo $this->Form->input('ProfessionalRecord.3.started_at',array('label'=> 'Début','dateFormat' => 'DMY', 'monthNames' => false, 'minYear' => date('Y') , 'maxYear' => date('Y') - 100));
                                    echo $this->Form->input('ProfessionalRecord.3.ended_at',array('label'=> 'Fin','dateFormat' => 'DMY', 'monthNames' => false, 'minYear' => date('Y') , 'maxYear' => date('Y') - 100));
                                endif;
                            ?>
                        </td>
                    </tr>
                    <tr>
                        <td ><label>Type de contrat</label></td>
                        <td><?php
                                $options['Stage'] = 'Stage';
                                $options['Bénévolat'] = 'Bénévolat';
                                $options['Employé'] = 'Employé';
                                if(isset($professionalRecords[2])):
                                    echo $this->Form->input('ProfessionalRecord3.kind',array('options' => $options, 'selected' => $professionalRecords[2]['kind'], 'type' => 'select', 'label' => false) );
                                else :
                                    echo $this->Form->input('ProfessionalRecord3.kind',array('options' => $options, 'type' => 'select', 'label' => false) );
                                endif;
                            ?>
                        </td>
                    </tr>
                </table>
                </td>
            </tr>
           <tr>
                <td><h4 class="h4SM">Vos diplomes</h4></td>
            </tr>
            <tr>
                <td colspan="2"><hr /></td>
            </tr>
            <?php
            echo '<tr>';
                echo '<td>';
                    echo '<label>Diplome 1</label>';
                echo '</td>';
                echo '<td>';
                echo '<div style="float:left">';
                if(isset($qualifications[0])):
                    echo $form->textarea('Qualification', array('label'=> false, 'value' => $qualifications[0]['label']));
                else :
                    echo $form->textarea('Qualification', array('label'=> false, 'value' => ''));
                endif;
                echo '</div>';
                echo '<div style="float:left">';
                if(isset($qualifications[0])):
                    echo $this->Form->input('Qualification.started_at',array('label'=> 'Début', 'selected' => $qualifications[0]['started_at'], 'dateFormat' => 'DMY', 'monthNames' => false, 'minYear' => date('Y')+5 , 'maxYear' => date('Y') - 100));
                    echo $this->Form->input('Qualification.ended_at',array('label'=> 'Fin', 'selected' => $qualifications[0]['ended_at'], 'dateFormat' => 'DMY', 'monthNames' => false, 'minYear' => date('Y')+5 , 'maxYear' => date('Y') - 100));
                else :
                    echo $this->Form->input('Qualification.started_at',array('label'=> 'Début','dateFormat' => 'DMY', 'monthNames' => false, 'minYear' => date('Y')+5 , 'maxYear' => date('Y') - 100));
                    echo $this->Form->input('Qualification.ended_at',array('label'=> 'Fin','dateFormat' => 'DMY', 'monthNames' => false, 'minYear' => date('Y')+5 , 'maxYear' => date('Y') - 100));
		endif;
                echo '</div>';
                echo '</td>';
            echo '</tr>';
            echo '<tr>';
                echo '<td>';
                    echo '<label>Diplome 2</label>';
                echo '</td>';
                echo '<td>';
                echo '<div style="float:left">';
                if(isset($qualifications[1])):
                    echo $form->textarea('Qualification.Qualification2', array('label'=> false, 'value' => $qualifications[1]['label']));
                else :
                    echo $form->textarea('Qualification.Qualification2', array('label'=> false, 'value' => ''));
                endif;
                echo '</div>';
                echo '<div style="float:left">';
               if(isset($qualifications[1])):
                    echo $this->Form->input('Qualification.started_at.2',array('label'=> 'Début', 'selected' => $qualifications[1]['started_at'], 'dateFormat' => 'DMY', 'monthNames' => false, 'minYear' => date('Y')+5 , 'maxYear' => date('Y') - 100));
                    echo $this->Form->input('Qualification.ended_at.2',array('label'=> 'Fin', 'selected' => $qualifications[1]['ended_at'], 'dateFormat' => 'DMY', 'monthNames' => false, 'minYear' => date('Y')+5 , 'maxYear' => date('Y') - 100));
                else :
                    echo $this->Form->input('Qualification.started_at.2',array('label'=> 'Début','dateFormat' => 'DMY', 'monthNames' => false, 'minYear' => date('Y')+5 , 'maxYear' => date('Y') - 100));
                    echo $this->Form->input('Qualification.ended_at.2',array('label'=> 'Fin','dateFormat' => 'DMY', 'monthNames' => false, 'minYear' => date('Y')+5 , 'maxYear' => date('Y') - 100));
		endif;
                echo '</div>';
                echo '</td>';
            echo '</tr>';
            echo '<tr>';
                echo '<td>';
                    echo '<label>Diplome 3</label>';
                echo '</td>';
                echo '<td>';
                    echo '<div style="float:left">';
                    if(isset($qualifications[2])):
                        echo $form->textarea('Qualification.Qualification3', array('label'=> false, 'value' => $qualifications[2]['label']));
                    else :
                        echo $form->textarea('Qualification.Qualification3', array('label'=> false, 'value' => ''));
                    endif;
                    echo '</div>';
                    echo '<div style="float:left">';
                    if(isset($qualifications[2])):
                        echo $this->Form->input('Qualification.started_at.3',array('label'=> 'Début', 'selected' => $qualifications[2]['started_at'], 'dateFormat' => 'DMY', 'monthNames' => false, 'minYear' => date('Y')+5 , 'maxYear' => date('Y') - 100));
                        echo $this->Form->input('Qualification.ended_at.3',array('label'=> 'Fin', 'selected' => $qualifications[2]['ended_at'], 'dateFormat' => 'DMY', 'monthNames' => false, 'minYear' => date('Y')+5 , 'maxYear' => date('Y') - 100));
                    else :
                        echo $this->Form->input('Qualification.started_at.3',array('label'=> 'Début','dateFormat' => 'DMY', 'monthNames' => false, 'minYear' => date('Y')+5 , 'maxYear' => date('Y') - 100));
                        echo $this->Form->input('Qualification.ended_at.3',array('label'=> 'Fin','dateFormat' => 'DMY', 'monthNames' => false, 'minYear' => date('Y')+5 , 'maxYear' => date('Y') - 100));
                    endif;
                    echo '</div>';
                echo '</td>';
            echo '</tr>';
            ?>

           <tr>
                <td><h4 class="h4SM">Vos compétences</h4></td>
            </tr>
            <tr>
                <td colspan="2"><hr /></td>
            </tr>

            <?php
            echo '<tr>';
                echo '<td>';
                    echo '<label>Compétences</label><br\> <em>(Séparées par un ";")</em>';
                echo '</td>';
                echo '<td>';
                    if(!isset ($skills)) :
                        echo $form->text('Skill.label', array('label'=> false));
                    else :
                        echo $form->text('Skill.label', array('label'=> false, 'value' => $skills));
                    endif;
                echo '</td>';
            echo '</tr>';
            ?>

           <tr>
                <td><h4 class="h4SM">Les catégories</h4></td>
            </tr>
            <tr>
                <td colspan="2"><hr /></td>
            </tr>

            <?php
            echo '<tr>';
                echo '<td>';
                    echo '<label>Catégorie du CV</label>';
                echo '</td>';
                echo '<td>';
                             
		echo $this->Form->input('Category.id', array('type' => 'select', 'options' => $categories, 'selected' => $selectedCat , 'label'=> false, 'multiple' => true));
                echo '</td>';
            echo '</tr>';
        ?>
    </table>


<?php echo $this->Form->end(__('Envoyer', true));?>
</div>
<!--<div class="actions">
	<h3><?php __('Actions'); ?></h3>
	<ul>

		<li><?php echo $this->Html->link(__('List Cvs', true), array('action' => 'index'));?></li>
		<li><?php echo $this->Html->link(__('List Users', true), array('controller' => 'users', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New User', true), array('controller' => 'users', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Categories', true), array('controller' => 'categories', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Category', true), array('controller' => 'categories', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Languages', true), array('controller' => 'languages', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Language', true), array('controller' => 'languages', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Professional Records', true), array('controller' => 'professional_records', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Professional Record', true), array('controller' => 'professional_records', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Qualifications', true), array('controller' => 'qualifications', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Qualification', true), array('controller' => 'qualifications', 'action' => 'add')); ?> </li>
		<li><?php echo $this->Html->link(__('List Skills', true), array('controller' => 'skills', 'action' => 'index')); ?> </li>
		<li><?php echo $this->Html->link(__('New Skill', true), array('controller' => 'skills', 'action' => 'add')); ?> </li>
	</ul>
</div>

-->